<!DOCTYPE HTML>
<html>
<head>
    <title>登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script type="application/x-javascript"> addEventListener("load", function () {
        setTimeout(hideURLbar, 0);
    }, false);

    function hideURLbar() {
        window.scrollTo(0, 1);
    } </script>
    <link href="../../css/bootstrap.css" rel="stylesheet" type="text/css" media="all">
    <link href="../../css/style.css" rel="stylesheet" type="text/css" media="all"/>
    <script src="../../js/jquery-2.1.1.min.js"></script>
    <link href="../../css/font-awesome.css" rel="stylesheet">
    <link href='https://fonts.googleapis.com/css?family=Carrois+Gothic' rel='stylesheet' type='text/css'>
    <link href='https://fonts.googleapis.com/css?family=Work+Sans:400,500,600' rel='stylesheet' type='text/css'>
</head>
<body>
<div class="login-page">
    <div class="login-main">
        <div class="login-head">
            <h1>人力资源管理系统 - 登 录</h1>
        </div>
        <div class="login-block">
            <form id="loginForm" action="">
                <input type="text" id="username" placeholder="请输入用户名">
                <input type="password" id="password" class="lock" placeholder="请输入密码">
                <div class="forgot-top-grids">
                    <div class="clearfix"></div>
                </div>
                <input id="login-btn" type="button" name="login" value="登录">
            </form>
        </div>
    </div>
</div>

<script src="../../js/jquery.nicescroll.js"></script>
<script src="../../js/scripts.js"></script>
<script src="../../js/bootstrap.js"></script>
<script>
    $(function () {
        $('#login-btn').click(function () {
            var Username = $("#username").val();
            var Password = $("#password").val();
            $.ajax({
                type: "POST",
                url:"/checkPsw.post",
                data: {
                    username: Username,
                    password: Password
                },
                success: function (data) {
                var result = data;
                if (result !== 0) {
                        window.location.href = "/user/index.html?id="+result;
//                    window.location.href = "/user/testManage.html";
                    } else {
                        alert("用户名或密码错误，请重试");
                    }
                },
                error: function () {
                    alert('登录异常');
                }
            })
        })
    })
</script>
</body>
</html>